<!doctype html>
<!--
@license
Copyright 2020 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
<head>
  <title>MWC Select Demo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
  <link rel="preload" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" as="style" type="text/css">
  <link rel="preload" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" as="style" type="text/css">
  <script type="module" src="index.js"></script>
  <script nomodule src="../../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
  <style>
    .unresolved main {
      opacity: 0;
    }
  </style>
  <link href="../shared/shared.css" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">
  <style>
    body {
      min-height: calc(100vh - 4em);
    }

    .abs {
      position: absolute;
      top: calc(100vh - 128px);
      right: calc(100vw - 100% + 16px);
    }

    [slot="graphic"].material-icons {
      background-color: gray;
      color: white;
    }

    mwc-select ~ div,
    div ~ mwc-select {
      margin-top: 8px;
    }

    #fullwidthParent {
      border: 1px solid black;
      width: 70%;
    }

    #fullwidthOptions {
      width: 100%;
    }
  </style>
</head>
<body class="unresolved">
  <demo-header component="Select" package="select"></demo-header>
  <main>
    <h2>Filled</h2>
    <mwc-select label="filled" id="filled">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Option 1</mwc-list-item>
      <mwc-list-item value="2">Option 2</mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>
    <div>Value: <span id="filledValue"></span></div>

    <h2>Outlined</h2>
    <mwc-select outlined label="outlined" id="outlined">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Option 1</mwc-list-item>
      <mwc-list-item value="2">Option 2</mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>
    <div>Value: <span id="outlinedValue"></span></div>

    <h2>Preselected</h2>
    <mwc-select label="preselected" id="preselected">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Option 1</mwc-list-item>
      <mwc-list-item value="2" selected>Option 2</mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>
    <div>Value: <span id="preselectedValue"></span></div>

    <h2>Icon</h2>
    <mwc-select label="has icon" icon="event">
      <mwc-list-item graphic="icon" value="1">Option 1</mwc-list-item>
      <mwc-list-item graphic="icon" value="2">Option 2</mwc-list-item>
      <mwc-list-item graphic="icon" value="3">Option 3</mwc-list-item>
    </mwc-select>

    <h2>Required</h2>
    <mwc-select required label="required filled" id="reqFilled">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Option 1</mwc-list-item>
      <mwc-list-item value="2">Option 2</mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>
    <div>Value: <span id="reqFilledValue"></span></div>
    <div>Valid: <span id="reqFilledValid"></span></div>

    <mwc-select outlined required label="required outlined" id="reqOutlined">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Option 1</mwc-list-item>
      <mwc-list-item value="2">Option 2</mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>
    <div>Value: <span id="reqOutlinedValue"></span></div>
    <div>Valid: <span id="reqOutlinedValid"></span></div>

    <h2>Disabled</h2>
    <mwc-select disabled label="disabled">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item disabled value="1">Option 1</mwc-list-item>
      <mwc-list-item value="2">Option 2</mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>

    <h2>Disabled Options</h2>
    <mwc-select label="disabled" id="disabledOptions">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Option 1</mwc-list-item>
      <mwc-list-item disabled value="2"><div>Option 2</div></mwc-list-item>
      <mwc-list-item value="3">Option 3</mwc-list-item>
    </mwc-select>
    <div>Value: <span id="disabledOptionsValue"></span></div>

    <h2>Natural Menu Width</h2>

    <style>
      #naturalOptions {
        max-width: 200px;
      }
    </style>
    <mwc-select label="natural width (long)" id="naturalOptions">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Some Really Really Really long text</mwc-list-item>
      <mwc-list-item value="2">Some Really Really Really long text</mwc-list-item>
      <mwc-list-item value="3">Some Really Really Really long text</mwc-list-item>
    </mwc-select>
    <div>
      <mwc-button raised label="toggle naturalMenuWidth" id="naturalButton">
      </mwc-button>
    </div>
    <div>
      <pre>mwc-select.naturalMenuWidth</pre> value:
      <span id="naturalValue">false</span>
    </div>

    <mwc-select label="natural width (short)" id="shortNaturalOptions">
      <mwc-list-item></mwc-list-item>
      <mwc-list-item value="1">Short text</mwc-list-item>
      <mwc-list-item value="2">Short text</mwc-list-item>
      <mwc-list-item value="3">Short text</mwc-list-item>
    </mwc-select>
    <div>
      <mwc-button raised label="toggle naturalMenuWidth" id="shortNaturalButton">
      </mwc-button>
    </div>
    <div>
      <pre>mwc-select.naturalMenuWidth</pre> value:
      <span id="shortNaturalValue">false</span>
    </div>

    <div id="fullwidthParent">
      <mwc-select label="fullwidth" id="fullwidthOptions">
        <mwc-list-item></mwc-list-item>
        <mwc-list-item value="1">Short text</mwc-list-item>
        <mwc-list-item value="2">Short text</mwc-list-item>
        <mwc-list-item value="3">Short text</mwc-list-item>
      </mwc-select>
    </div>
    <div>
      <mwc-button raised label="toggle fullwidth" id="fullwidthButton">
      </mwc-button>
    </div>
    <div>
      <pre>mwc-select.fullwidth</pre> value:
      <span id="fullwidthValue">false</span>
    </div>
  </main>
  <script nomodule src="index.es5.js"></script>
</body>
</html>
